<template>
  <div class="full" ref="domRef"></div>
</template>

<script>
import { defineComponent, nextTick, onMounted, ref } from 'vue';
import { init, graphic } from 'echarts';
export default defineComponent({
  name: 'PieChart',
  props: {
    value: {
      type: String,
      required: true,
      default: 0,
    },
  },
  setup(props) {
    const domRef = ref();

    const initChart = () => {
      const chart = init(domRef.value, 'purple');
      chart.setOption({
        tooltip: {
          trigger: 'item',
        },
        
        series: [
          {
            name: 'Access From',
            type: 'pie',
            radius: '100%',
            label: {
              formatter: '{b}\n {c}',
              position: 'inside',
              color: '#fff',
              fontSize: '16px',
            },
            data: [
              { value: 1048, name: '全部完成' },
              { value: 735, name: '部分完成' },
              { value: 580, name: '即将完成' },
              { value: 484, name: '未完成' },
            ],
          },
        ],
      });
    };

    onMounted(() => {
      nextTick(() => {
        initChart();
      });
    });

    return {
      domRef,
    };
  },
});
</script>

<style lang="scss" scoped></style>
